import {useState} from 'react'
function App(){
  // const [num,setNum] = useState(1);
  //初始状态为函数时，需要有返回值，不能为异步
  const [num,setNum] = useState(()=>{
    const num1 = 1+2;
    const num2 = 2+3;
    return num1+num2
  })
  return(
    <div onClick={()=>setNum(num+1)}>{num}</div>
  )
}
export default App;
